"use strict";var ce=Object.defineProperty;var ot=Object.getOwnPropertyDescriptor;var at=Object.getOwnPropertyNames;var st=Object.prototype.hasOwnProperty;var ut=(e,r)=>{for(var c in r)ce(e,c,{get:r[c],enumerable:!0})},yt=(e,r,c,T)=>{if(r&&typeof r=="object"||typeof r=="function")for(let d of at(r))!st.call(e,d)&&d!==c&&ce(e,d,{get:()=>r[d],enumerable:!(T=ot(r,d))||T.enumerable});return e};var dt=e=>yt(ce({},"__esModule",{value:!0}),e);var xt={};ut(xt,{QueryStatus:()=>ie,buildCreateApi:()=>de,copyWithStructuralSharing:()=>G,coreModule:()=>pe,coreModuleName:()=>re,createApi:()=>it,defaultSerializeQueryArgs:()=>ne,fakeBaseQuery:()=>Le,fetchBaseQuery:()=>be,retry:()=>Me,setupListeners:()=>ke,skipToken:()=>te});module.exports=dt(xt);var ie=(d=>(d.uninitialized="uninitialized",d.pending="pending",d.fulfilled="fulfilled",d.rejected="rejected",d))(ie||{});function Te(e){return{status:e,isUninitialized:e==="uninitialized",isLoading:e==="pending",isSuccess:e==="fulfilled",isError:e==="rejected"}}function he(e){return new RegExp("(^|:)//").test(e)}var pt=e=>e.replace(/\/$/,""),ct=e=>e.replace(/^\//,"");function Qe(e,r){if(!e)return r;if(!r)return e;if(he(r))return r;let c=e.endsWith("/")||!r.startsWith("?")?"/":"";return e=pt(e),r=ct(r),`${e}${c}${r}`}var le=e=>[].concat(...e);function Re(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}function xe(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}var o=require("@reduxjs/toolkit");var Se=o.isPlainObject;function G(e,r){if(e===r||!(Se(e)&&Se(r)||Array.isArray(e)&&Array.isArray(r)))return r;let c=Object.keys(r),T=Object.keys(e),d=c.length===T.length,R=Array.isArray(r)?[]:{};for(let S of c)R[S]=G(e[S],r[S]),d&&(d=e[S]===R[S]);return d?e:R}var Ae=(...e)=>fetch(...e),lt=e=>e.status>=200&&e.status<=299,ft=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function De(e){if(!(0,o.isPlainObject)(e))return e;let r={...e};for(let[c,T]of Object.entries(r))T===void 0&&delete r[c];return r}function be({baseUrl:e,prepareHeaders:r=l=>l,fetchFn:c=Ae,paramsSerializer:T,isJsonContentType:d=ft,jsonContentType:R="application/json",jsonReplacer:S,timeout:M,responseHandler:k,validateStatus:m,...A}={}){return typeof fetch>"u"&&c===Ae&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),async(n,t)=>{let{signal:g,getState:x,extra:p,endpoint:y,forced:a,type:s}=t,i,{url:u,headers:h=new Headers(A.headers),params:f=void 0,responseHandler:Q=k??"json",validateStatus:E=m??lt,timeout:D=M,...B}=typeof n=="string"?{url:n}:n,b={...A,signal:g,...B};h=new Headers(De(h)),b.headers=await r(h,{getState:x,extra:p,endpoint:y,forced:a,type:s})||h;let v=F=>typeof F=="object"&&((0,o.isPlainObject)(F)||Array.isArray(F)||typeof F.toJSON=="function");if(!b.headers.has("content-type")&&v(b.body)&&b.headers.set("content-type",R),v(b.body)&&d(b.headers)&&(b.body=JSON.stringify(b.body,S)),f){let F=~u.indexOf("?")?"&":"?",w=T?T(f):new URLSearchParams(De(f));u+=F+w}u=Qe(e,u);let P=new Request(u,b);i={request:new Request(u,b)};let O,N=!1,I=D&&setTimeout(()=>{N=!0,t.abort()},D);try{O=await c(P)}catch(F){return{error:{status:N?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(F)},meta:i}}finally{I&&clearTimeout(I)}let K=O.clone();i.response=K;let q,J="";try{let F;if(await Promise.all([l(O,Q).then(w=>q=w,w=>F=w),K.text().then(w=>J=w,()=>{})]),F)throw F}catch(F){return{error:{status:"PARSING_ERROR",originalStatus:O.status,data:J,error:String(F)},meta:i}}return E(O,q)?{data:q,meta:i}:{error:{status:O.status,data:q},meta:i}};async function l(n,t){if(typeof t=="function")return t(n);if(t==="content-type"&&(t=d(n.headers)?"json":"text"),t==="json"){let g=await n.text();return g.length?JSON.parse(g):null}return n.text()}}var j=class{constructor(r,c=void 0){this.value=r;this.meta=c}};async function mt(e=0,r=5){let c=Math.min(e,r),T=~~((Math.random()+.4)*(300<<c));await new Promise(d=>setTimeout(R=>d(R),T))}function gt(e){throw Object.assign(new j({error:e}),{throwImmediately:!0})}var Ee={},Tt=(e,r)=>async(c,T,d)=>{let R=[5,(r||Ee).maxRetries,(d||Ee).maxRetries].filter(A=>A!==void 0),[S]=R.slice(-1),k={maxRetries:S,backoff:mt,retryCondition:(A,l,{attempt:n})=>n<=S,...r,...d},m=0;for(;;)try{let A=await e(c,T,d);if(A.error)throw new j(A);return A}catch(A){if(m++,A.throwImmediately){if(A instanceof j)return A.value;throw A}if(A instanceof j&&!k.retryCondition(A.value.error,c,{attempt:m,baseQueryApi:T,extraOptions:d}))return A.value;await k.backoff(m,k.maxRetries)}},Me=Object.assign(Tt,{fail:gt});var _=(0,o.createAction)("__rtkq/focused"),W=(0,o.createAction)("__rtkq/unfocused"),L=(0,o.createAction)("__rtkq/online"),V=(0,o.createAction)("__rtkq/offline"),fe=!1;function ke(e,r){function c(){let T=()=>e(_()),d=()=>e(W()),R=()=>e(L()),S=()=>e(V()),M=()=>{window.document.visibilityState==="visible"?T():d()};return fe||typeof window<"u"&&window.addEventListener&&(window.addEventListener("visibilitychange",M,!1),window.addEventListener("focus",T,!1),window.addEventListener("online",R,!1),window.addEventListener("offline",S,!1),fe=!0),()=>{window.removeEventListener("focus",T),window.removeEventListener("visibilitychange",M),window.removeEventListener("online",R),window.removeEventListener("offline",S),fe=!1}}return r?r(e,{onFocus:_,onFocusLost:W,onOffline:V,onOnline:L}):c()}function ae(e){return e.type==="query"}function Be(e){return e.type==="mutation"}function Y(e,r,c,T,d,R){return ht(e)?e(r,c,T,d).map(oe).map(R):Array.isArray(e)?e.map(oe).map(R):[]}function ht(e){return typeof e=="function"}function oe(e){return typeof e=="string"?{type:e}:e}var zt=require("@reduxjs/toolkit");function me(e){return e!=null}function U(e){let r=0;for(let c in e)r++;return r}function ve(e,r){return e.catch(r)}var $=Symbol("forceQueryFn"),X=e=>typeof e[$]=="function";function Pe({serializeQueryArgs:e,queryThunk:r,mutationThunk:c,api:T,context:d}){let R=new Map,S=new Map,{unsubscribeQueryResult:M,removeMutationResult:k,updateSubscriptionOptions:m}=T.internalActions;return{buildInitiateQuery:x,buildInitiateMutation:p,getRunningQueryThunk:A,getRunningMutationThunk:l,getRunningQueriesThunk:n,getRunningMutationsThunk:t};function A(y,a){return s=>{let i=d.endpointDefinitions[y],u=e({queryArgs:a,endpointDefinition:i,endpointName:y});return R.get(s)?.[u]}}function l(y,a){return s=>S.get(s)?.[a]}function n(){return y=>Object.values(R.get(y)||{}).filter(me)}function t(){return y=>Object.values(S.get(y)||{}).filter(me)}function g(y){}function x(y,a){let s=(i,{subscribe:u=!0,forceRefetch:h,subscriptionOptions:f,[$]:Q,...E}={})=>(D,B)=>{let b=e({queryArgs:i,endpointDefinition:a,endpointName:y}),v=r({...E,type:"query",subscribe:u,forceRefetch:h,subscriptionOptions:f,endpointName:y,originalArgs:i,queryCacheKey:b,[$]:Q}),P=T.endpoints[y].select(i),C=D(v),O=P(B());let{requestId:N,abort:I}=C,K=O.requestId!==N,q=R.get(D)?.[b],J=()=>P(B()),F=Object.assign(Q?C.then(J):K&&!q?Promise.resolve(O):Promise.all([q,C]).then(J),{arg:i,requestId:N,subscriptionOptions:f,queryCacheKey:b,abort:I,async unwrap(){let w=await F;if(w.isError)throw w.error;return w.data},refetch:()=>D(s(i,{subscribe:!1,forceRefetch:!0})),unsubscribe(){u&&D(M({queryCacheKey:b,requestId:N}))},updateSubscriptionOptions(w){F.subscriptionOptions=w,D(m({endpointName:y,requestId:N,queryCacheKey:b,options:w}))}});if(!q&&!K&&!Q){let w=R.get(D)||{};w[b]=F,R.set(D,w),F.then(()=>{delete w[b],U(w)||R.delete(D)})}return F};return s}function p(y){return(a,{track:s=!0,fixedCacheKey:i}={})=>(u,h)=>{let f=c({type:"mutation",endpointName:y,originalArgs:a,track:s,fixedCacheKey:i}),Q=u(f);let{requestId:E,abort:D,unwrap:B}=Q,b=ve(Q.unwrap().then(O=>({data:O})),O=>({error:O})),v=()=>{u(k({requestId:E,fixedCacheKey:i}))},P=Object.assign(b,{arg:Q.arg,requestId:E,abort:D,unwrap:B,reset:v}),C=S.get(u)||{};return S.set(u,C),C[E]=P,P.then(()=>{delete C[E],U(C)||S.delete(u)}),i&&(C[i]=P,P.then(()=>{C[i]===P&&(delete C[i],U(C)||S.delete(u))})),P}}}var se=require("immer");function Fe(e){return e}function we({reducerPath:e,baseQuery:r,context:{endpointDefinitions:c},serializeQueryArgs:T,api:d,assertTagType:R}){let S=(a,s,i,u)=>(h,f)=>{let Q=c[a],E=T({queryArgs:s,endpointDefinition:Q,endpointName:a});if(h(d.internalActions.queryResultPatched({queryCacheKey:E,patches:i})),!u)return;let D=d.endpoints[a].select(s)(f()),B=Y(Q.providesTags,D.data,void 0,s,{},R);h(d.internalActions.updateProvidedBy({queryCacheKey:E,providedTags:B}))},M=(a,s,i,u=!0)=>(h,f)=>{let E=d.endpoints[a].select(s)(f()),D={patches:[],inversePatches:[],undo:()=>h(d.util.patchQueryData(a,s,D.inversePatches,u))};if(E.status==="uninitialized")return D;let B;if("data"in E)if((0,se.isDraftable)(E.data)){let[b,v,P]=(0,se.produceWithPatches)(E.data,i);D.patches.push(...v),D.inversePatches.push(...P),B=b}else B=i(E.data),D.patches.push({op:"replace",path:[],value:B}),D.inversePatches.push({op:"replace",path:[],value:E.data});return D.patches.length===0||h(d.util.patchQueryData(a,s,D.patches,u)),D},k=(a,s,i)=>u=>u(d.endpoints[a].initiate(s,{subscribe:!1,forceRefetch:!0,[$]:()=>({data:i})})),m=async(a,{signal:s,abort:i,rejectWithValue:u,fulfillWithValue:h,dispatch:f,getState:Q,extra:E})=>{let D=c[a.endpointName];try{let B=Fe,b,v={signal:s,abort:i,dispatch:f,getState:Q,extra:E,endpoint:a.endpointName,type:a.type,forced:a.type==="query"?A(a,Q()):void 0},P=a.type==="query"?a[$]:void 0;if(P?b=P():D.query?(b=await r(D.query(a.originalArgs),v,D.extraOptions),D.transformResponse&&(B=D.transformResponse)):b=await D.queryFn(a.originalArgs,v,D.extraOptions,C=>r(C,v,D.extraOptions)),typeof process<"u",b.error)throw new j(b.error,b.meta);return h(await B(b.data,b.meta,a.originalArgs),{fulfilledTimeStamp:Date.now(),baseQueryMeta:b.meta,[o.SHOULD_AUTOBATCH]:!0})}catch(B){let b=B;if(b instanceof j){let v=Fe;D.query&&D.transformErrorResponse&&(v=D.transformErrorResponse);try{return u(await v(b.value,b.meta,a.originalArgs),{baseQueryMeta:b.meta,[o.SHOULD_AUTOBATCH]:!0})}catch(P){b=P}}throw typeof process<"u",console.error(b),b}};function A(a,s){let i=s[e]?.queries?.[a.queryCacheKey],u=s[e]?.config.refetchOnMountOrArgChange,h=i?.fulfilledTimeStamp,f=a.forceRefetch??(a.subscribe&&u);return f?f===!0||(Number(new Date)-Number(h))/1e3>=f:!1}let l=(0,o.createAsyncThunk)(`${e}/executeQuery`,m,{getPendingMeta(){return{startedTimeStamp:Date.now(),[o.SHOULD_AUTOBATCH]:!0}},condition(a,{getState:s}){let i=s(),u=i[e]?.queries?.[a.queryCacheKey],h=u?.fulfilledTimeStamp,f=a.originalArgs,Q=u?.originalArgs,E=c[a.endpointName];return X(a)?!0:u?.status==="pending"?!1:A(a,i)||ae(E)&&E?.forceRefetch?.({currentArg:f,previousArg:Q,endpointState:u,state:i})?!0:!h},dispatchConditionRejection:!0}),n=(0,o.createAsyncThunk)(`${e}/executeMutation`,m,{getPendingMeta(){return{startedTimeStamp:Date.now(),[o.SHOULD_AUTOBATCH]:!0}}}),t=a=>"force"in a,g=a=>"ifOlderThan"in a,x=(a,s,i)=>(u,h)=>{let f=t(i)&&i.force,Q=g(i)&&i.ifOlderThan,E=(B=!0)=>{let b={forceRefetch:B,isPrefetch:!0};return d.endpoints[a].initiate(s,b)},D=d.endpoints[a].select(s)(h());if(f)u(E());else if(Q){let B=D?.fulfilledTimeStamp;if(!B){u(E());return}(Number(new Date)-Number(new Date(B)))/1e3>=Q&&u(E())}else u(E(!1))};function p(a){return s=>s?.meta?.arg?.endpointName===a}function y(a,s){return{matchPending:(0,o.isAllOf)((0,o.isPending)(a),p(s)),matchFulfilled:(0,o.isAllOf)((0,o.isFulfilled)(a),p(s)),matchRejected:(0,o.isAllOf)((0,o.isRejected)(a),p(s))}}return{queryThunk:l,mutationThunk:n,prefetch:x,updateQueryData:M,upsertQueryData:k,patchQueryData:S,buildMatchThunkActions:y}}function ue(e,r,c,T){return Y(c[e.meta.arg.endpointName][r],(0,o.isFulfilled)(e)?e.payload:void 0,(0,o.isRejectedWithValue)(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,T)}var Ie=require("immer"),ee=require("immer");function ye(e,r,c){let T=e[r];T&&c(T)}function z(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function Ce(e,r,c){let T=e[z(r)];T&&c(T)}var Z={};function Oe({reducerPath:e,queryThunk:r,mutationThunk:c,context:{endpointDefinitions:T,apiUid:d,extractRehydrationInfo:R,hasRehydrationInfo:S},assertTagType:M,config:k}){let m=(0,o.createAction)(`${e}/resetApiState`),A=(0,o.createSlice)({name:`${e}/queries`,initialState:Z,reducers:{removeQueryResult:{reducer(s,{payload:{queryCacheKey:i}}){delete s[i]},prepare:(0,o.prepareAutoBatched)()},queryResultPatched:{reducer(s,{payload:{queryCacheKey:i,patches:u}}){ye(s,i,h=>{h.data=(0,ee.applyPatches)(h.data,u.concat())})},prepare:(0,o.prepareAutoBatched)()}},extraReducers(s){s.addCase(r.pending,(i,{meta:u,meta:{arg:h}})=>{let f=X(h);i[h.queryCacheKey]??={status:"uninitialized",endpointName:h.endpointName},ye(i,h.queryCacheKey,Q=>{Q.status="pending",Q.requestId=f&&Q.requestId?Q.requestId:u.requestId,h.originalArgs!==void 0&&(Q.originalArgs=h.originalArgs),Q.startedTimeStamp=u.startedTimeStamp})}).addCase(r.fulfilled,(i,{meta:u,payload:h})=>{ye(i,u.arg.queryCacheKey,f=>{if(f.requestId!==u.requestId&&!X(u.arg))return;let{merge:Q}=T[u.arg.endpointName];if(f.status="fulfilled",Q)if(f.data!==void 0){let{fulfilledTimeStamp:E,arg:D,baseQueryMeta:B,requestId:b}=u,v=(0,o.createNextState)(f.data,P=>Q(P,h,{arg:D.originalArgs,baseQueryMeta:B,fulfilledTimeStamp:E,requestId:b}));f.data=v}else f.data=h;else f.data=T[u.arg.endpointName].structuralSharing??!0?G((0,Ie.isDraft)(f.data)?(0,ee.original)(f.data):f.data,h):h;delete f.error,f.fulfilledTimeStamp=u.fulfilledTimeStamp})}).addCase(r.rejected,(i,{meta:{condition:u,arg:h,requestId:f},error:Q,payload:E})=>{ye(i,h.queryCacheKey,D=>{if(!u){if(D.requestId!==f)return;D.status="rejected",D.error=E??Q}})}).addMatcher(S,(i,u)=>{let{queries:h}=R(u);for(let[f,Q]of Object.entries(h))(Q?.status==="fulfilled"||Q?.status==="rejected")&&(i[f]=Q)})}}),l=(0,o.createSlice)({name:`${e}/mutations`,initialState:Z,reducers:{removeMutationResult:{reducer(s,{payload:i}){let u=z(i);u in s&&delete s[u]},prepare:(0,o.prepareAutoBatched)()}},extraReducers(s){s.addCase(c.pending,(i,{meta:u,meta:{requestId:h,arg:f,startedTimeStamp:Q}})=>{f.track&&(i[z(u)]={requestId:h,status:"pending",endpointName:f.endpointName,startedTimeStamp:Q})}).addCase(c.fulfilled,(i,{payload:u,meta:h})=>{h.arg.track&&Ce(i,h,f=>{f.requestId===h.requestId&&(f.status="fulfilled",f.data=u,f.fulfilledTimeStamp=h.fulfilledTimeStamp)})}).addCase(c.rejected,(i,{payload:u,error:h,meta:f})=>{f.arg.track&&Ce(i,f,Q=>{Q.requestId===f.requestId&&(Q.status="rejected",Q.error=u??h)})}).addMatcher(S,(i,u)=>{let{mutations:h}=R(u);for(let[f,Q]of Object.entries(h))(Q?.status==="fulfilled"||Q?.status==="rejected")&&f!==Q?.requestId&&(i[f]=Q)})}}),n=(0,o.createSlice)({name:`${e}/invalidation`,initialState:Z,reducers:{updateProvidedBy:{reducer(s,i){let{queryCacheKey:u,providedTags:h}=i.payload;for(let f of Object.values(s))for(let Q of Object.values(f)){let E=Q.indexOf(u);E!==-1&&Q.splice(E,1)}for(let{type:f,id:Q}of h){let E=(s[f]??={})[Q||"__internal_without_id"]??=[];E.includes(u)||E.push(u)}},prepare:(0,o.prepareAutoBatched)()}},extraReducers(s){s.addCase(A.actions.removeQueryResult,(i,{payload:{queryCacheKey:u}})=>{for(let h of Object.values(i))for(let f of Object.values(h)){let Q=f.indexOf(u);Q!==-1&&f.splice(Q,1)}}).addMatcher(S,(i,u)=>{let{provided:h}=R(u);for(let[f,Q]of Object.entries(h))for(let[E,D]of Object.entries(Q)){let B=(i[f]??={})[E||"__internal_without_id"]??=[];for(let b of D)B.includes(b)||B.push(b)}}).addMatcher((0,o.isAnyOf)((0,o.isFulfilled)(r),(0,o.isRejectedWithValue)(r)),(i,u)=>{let h=ue(u,"providesTags",T,M),{queryCacheKey:f}=u.meta.arg;n.caseReducers.updateProvidedBy(i,n.actions.updateProvidedBy({queryCacheKey:f,providedTags:h}))})}}),t=(0,o.createSlice)({name:`${e}/subscriptions`,initialState:Z,reducers:{updateSubscriptionOptions(s,i){},unsubscribeQueryResult(s,i){},internal_getRTKQSubscriptions(){}}}),g=(0,o.createSlice)({name:`${e}/internalSubscriptions`,initialState:Z,reducers:{subscriptionsUpdated:{reducer(s,i){return(0,ee.applyPatches)(s,i.payload)},prepare:(0,o.prepareAutoBatched)()}}}),x=(0,o.createSlice)({name:`${e}/config`,initialState:{online:Re(),focused:xe(),middlewareRegistered:!1,...k},reducers:{middlewareRegistered(s,{payload:i}){s.middlewareRegistered=s.middlewareRegistered==="conflict"||d!==i?"conflict":!0}},extraReducers:s=>{s.addCase(L,i=>{i.online=!0}).addCase(V,i=>{i.online=!1}).addCase(_,i=>{i.focused=!0}).addCase(W,i=>{i.focused=!1}).addMatcher(S,i=>({...i}))}}),p=(0,o.combineReducers)({queries:A.reducer,mutations:l.reducer,provided:n.reducer,subscriptions:g.reducer,config:x.reducer}),y=(s,i)=>p(m.match(i)?void 0:s,i),a={...x.actions,...A.actions,...t.actions,...g.actions,...l.actions,...n.actions,resetApiState:m};return{reducer:y,actions:a}}var te=Symbol.for("RTKQ/skipToken"),Ke={status:"uninitialized"},qe=(0,o.createNextState)(Ke,()=>{}),Ne=(0,o.createNextState)(Ke,()=>{});function je({serializeQueryArgs:e,reducerPath:r,createSelector:c}){let T=l=>qe,d=l=>Ne;return{buildQuerySelector:M,buildMutationSelector:k,selectInvalidatedBy:m,selectCachedArgsForQuery:A};function R(l){return{...l,...Te(l.status)}}function S(l){return l[r]}function M(l,n){return t=>{let g=e({queryArgs:t,endpointDefinition:n,endpointName:l});return c(t===te?T:y=>S(y)?.queries?.[g]??qe,R)}}function k(){return l=>{let n;return typeof l=="object"?n=z(l)??te:n=l,c(n===te?d:x=>S(x)?.mutations?.[n]??Ne,R)}}function m(l,n){let t=l[r],g=new Set;for(let x of n.map(oe)){let p=t.provided[x.type];if(!p)continue;let y=(x.id!==void 0?p[x.id]:le(Object.values(p)))??[];for(let a of y)g.add(a)}return le(Array.from(g.values()).map(x=>{let p=t.queries[x];return p?[{queryCacheKey:x,endpointName:p.endpointName,originalArgs:p.originalArgs}]:[]}))}function A(l,n){return Object.values(l[r].queries).filter(t=>t?.endpointName===n&&t.status!=="uninitialized").map(t=>t.originalArgs)}}var He=require("@reduxjs/toolkit");var Ue=WeakMap?new WeakMap:void 0,ne=({endpointName:e,queryArgs:r})=>{let c="",T=Ue?.get(r);if(typeof T=="string")c=T;else{let d=JSON.stringify(r,(R,S)=>(S=typeof S=="bigint"?{$bigint:S.toString()}:S,S=(0,o.isPlainObject)(S)?Object.keys(S).sort().reduce((M,k)=>(M[k]=S[k],M),{}):S,S));(0,o.isPlainObject)(r)&&Ue?.set(r,d),c=d}return`${e}(${c})`};var ge=require("reselect");function de(...e){return function(c){let T=(0,ge.weakMapMemoize)(m=>c.extractRehydrationInfo?.(m,{reducerPath:c.reducerPath??"api"})),d={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...c,extractRehydrationInfo:T,serializeQueryArgs(m){let A=ne;if("serializeQueryArgs"in m.endpointDefinition){let l=m.endpointDefinition.serializeQueryArgs;A=n=>{let t=l(n);return typeof t=="string"?t:ne({...n,queryArgs:t})}}else c.serializeQueryArgs&&(A=c.serializeQueryArgs);return A(m)},tagTypes:[...c.tagTypes||[]]},R={endpointDefinitions:{},batch(m){m()},apiUid:(0,o.nanoid)(),extractRehydrationInfo:T,hasRehydrationInfo:(0,ge.weakMapMemoize)(m=>T(m)!=null)},S={injectEndpoints:k,enhanceEndpoints({addTagTypes:m,endpoints:A}){if(m)for(let l of m)d.tagTypes.includes(l)||d.tagTypes.push(l);if(A)for(let[l,n]of Object.entries(A))typeof n=="function"?n(R.endpointDefinitions[l]):Object.assign(R.endpointDefinitions[l]||{},n);return S}},M=e.map(m=>m.init(S,d,R));function k(m){let A=m.endpoints({query:l=>({...l,type:"query"}),mutation:l=>({...l,type:"mutation"})});for(let[l,n]of Object.entries(A)){if(m.overrideExisting!==!0&&l in R.endpointDefinitions){if(m.overrideExisting==="throw")throw new Error((0,He.formatProdErrorMessage)(39));typeof process<"u";continue}R.endpointDefinitions[l]=n;for(let t of M)t.injectEndpoint(l,n)}return S}return S.injectEndpoints({endpoints:c.endpoints})}}var _e=require("@reduxjs/toolkit");function Le(){return function(){throw new Error((0,_e.formatProdErrorMessage)(33))}}var ze=require("@reduxjs/toolkit");function Qt(e){for(let r in e)return!1;return!0}var Rt=2147483647/1e3-1,We=({reducerPath:e,api:r,queryThunk:c,context:T,internalState:d})=>{let{removeQueryResult:R,unsubscribeQueryResult:S}=r.internalActions,M=(0,ze.isAnyOf)(S.match,c.fulfilled,c.rejected);function k(n){let t=d.currentSubscriptions[n];return!!t&&!Qt(t)}let m={},A=(n,t,g)=>{if(M(n)){let x=t.getState()[e],{queryCacheKey:p}=S.match(n)?n.payload:n.meta.arg;l(p,x.queries[p]?.endpointName,t,x.config)}if(r.util.resetApiState.match(n))for(let[x,p]of Object.entries(m))p&&clearTimeout(p),delete m[x];if(T.hasRehydrationInfo(n)){let x=t.getState()[e],{queries:p}=T.extractRehydrationInfo(n);for(let[y,a]of Object.entries(p))l(y,a?.endpointName,t,x.config)}};function l(n,t,g,x){let y=T.endpointDefinitions[t]?.keepUnusedDataFor??x.keepUnusedDataFor;if(y===1/0)return;let a=Math.max(0,Math.min(y,Rt));if(!k(n)){let s=m[n];s&&clearTimeout(s),m[n]=setTimeout(()=>{k(n)||g.dispatch(R({queryCacheKey:n})),delete m[n]},a*1e3)}}return A};var Ve=({reducerPath:e,context:r,context:{endpointDefinitions:c},mutationThunk:T,queryThunk:d,api:R,assertTagType:S,refetchQuery:M,internalState:k})=>{let{removeQueryResult:m}=R.internalActions,A=(0,o.isAnyOf)((0,o.isFulfilled)(T),(0,o.isRejectedWithValue)(T)),l=(0,o.isAnyOf)((0,o.isFulfilled)(T,d),(0,o.isRejected)(T,d)),n=[],t=(p,y)=>{A(p)?x(ue(p,"invalidatesTags",c,S),y):l(p)?x([],y):R.util.invalidateTags.match(p)&&x(Y(p.payload,void 0,void 0,void 0,void 0,S),y)};function g(p){for(let y in p.queries)if(p.queries[y]?.status==="pending")return!0;for(let y in p.mutations)if(p.mutations[y]?.status==="pending")return!0;return!1}function x(p,y){let a=y.getState(),s=a[e];if(n.push(...p),s.config.invalidationBehavior==="delayed"&&g(s))return;let i=n;if(n=[],i.length===0)return;let u=R.util.selectInvalidatedBy(a,i);r.batch(()=>{let h=Array.from(u.values());for(let{queryCacheKey:f}of h){let Q=s.queries[f],E=k.currentSubscriptions[f]??{};Q&&(U(E)===0?y.dispatch(m({queryCacheKey:f})):Q.status!=="uninitialized"&&y.dispatch(M(Q,f)))}})}return t};var $e=({reducerPath:e,queryThunk:r,api:c,refetchQuery:T,internalState:d})=>{let R={},S=(n,t)=>{(c.internalActions.updateSubscriptionOptions.match(n)||c.internalActions.unsubscribeQueryResult.match(n))&&k(n.payload,t),(r.pending.match(n)||r.rejected.match(n)&&n.meta.condition)&&k(n.meta.arg,t),(r.fulfilled.match(n)||r.rejected.match(n)&&!n.meta.condition)&&M(n.meta.arg,t),c.util.resetApiState.match(n)&&A()};function M({queryCacheKey:n},t){let g=t.getState()[e],x=g.queries[n],p=d.currentSubscriptions[n];if(!x||x.status==="uninitialized")return;let{lowestPollingInterval:y,skipPollingIfUnfocused:a}=l(p);if(!Number.isFinite(y))return;let s=R[n];s?.timeout&&(clearTimeout(s.timeout),s.timeout=void 0);let i=Date.now()+y;R[n]={nextPollTimestamp:i,pollingInterval:y,timeout:setTimeout(()=>{(g.config.focused||!a)&&t.dispatch(T(x,n)),M({queryCacheKey:n},t)},y)}}function k({queryCacheKey:n},t){let x=t.getState()[e].queries[n],p=d.currentSubscriptions[n];if(!x||x.status==="uninitialized")return;let{lowestPollingInterval:y}=l(p);if(!Number.isFinite(y)){m(n);return}let a=R[n],s=Date.now()+y;(!a||s<a.nextPollTimestamp)&&M({queryCacheKey:n},t)}function m(n){let t=R[n];t?.timeout&&clearTimeout(t.timeout),delete R[n]}function A(){for(let n of Object.keys(R))m(n)}function l(n={}){let t=!1,g=Number.POSITIVE_INFINITY;for(let x in n)n[x].pollingInterval&&(g=Math.min(n[x].pollingInterval,g),t=n[x].skipPollingIfUnfocused||t);return{lowestPollingInterval:g,skipPollingIfUnfocused:t}}return S};var Je=({reducerPath:e,context:r,api:c,refetchQuery:T,internalState:d})=>{let{removeQueryResult:R}=c.internalActions,S=(k,m)=>{_.match(k)&&M(m,"refetchOnFocus"),L.match(k)&&M(m,"refetchOnReconnect")};function M(k,m){let A=k.getState()[e],l=A.queries,n=d.currentSubscriptions;r.batch(()=>{for(let t of Object.keys(n)){let g=l[t],x=n[t];if(!x||!g)continue;(Object.values(x).some(y=>y[m]===!0)||Object.values(x).every(y=>y[m]===void 0)&&A.config[m])&&(U(x)===0?k.dispatch(R({queryCacheKey:t})):g.status!=="uninitialized"&&k.dispatch(T(g,t)))}})}return S};var Ge=new Error("Promise never resolved before cacheEntryRemoved."),Ye=({api:e,reducerPath:r,context:c,queryThunk:T,mutationThunk:d,internalState:R})=>{let S=(0,o.isAsyncThunkAction)(T),M=(0,o.isAsyncThunkAction)(d),k=(0,o.isFulfilled)(T,d),m={},A=(t,g,x)=>{let p=l(t);if(T.pending.match(t)){let y=x[r].queries[p],a=g.getState()[r].queries[p];!y&&a&&n(t.meta.arg.endpointName,t.meta.arg.originalArgs,p,g,t.meta.requestId)}else if(d.pending.match(t))g.getState()[r].mutations[p]&&n(t.meta.arg.endpointName,t.meta.arg.originalArgs,p,g,t.meta.requestId);else if(k(t)){let y=m[p];y?.valueResolved&&(y.valueResolved({data:t.payload,meta:t.meta.baseQueryMeta}),delete y.valueResolved)}else if(e.internalActions.removeQueryResult.match(t)||e.internalActions.removeMutationResult.match(t)){let y=m[p];y&&(delete m[p],y.cacheEntryRemoved())}else if(e.util.resetApiState.match(t))for(let[y,a]of Object.entries(m))delete m[y],a.cacheEntryRemoved()};function l(t){return S(t)?t.meta.arg.queryCacheKey:M(t)?t.meta.arg.fixedCacheKey??t.meta.requestId:e.internalActions.removeQueryResult.match(t)?t.payload.queryCacheKey:e.internalActions.removeMutationResult.match(t)?z(t.payload):""}function n(t,g,x,p,y){let a=c.endpointDefinitions[t],s=a?.onCacheEntryAdded;if(!s)return;let i={},u=new Promise(B=>{i.cacheEntryRemoved=B}),h=Promise.race([new Promise(B=>{i.valueResolved=B}),u.then(()=>{throw Ge})]);h.catch(()=>{}),m[x]=i;let f=e.endpoints[t].select(a.type==="query"?g:x),Q=p.dispatch((B,b,v)=>v),E={...p,getCacheEntry:()=>f(p.getState()),requestId:y,extra:Q,updateCachedData:a.type==="query"?B=>p.dispatch(e.util.updateQueryData(t,g,B)):void 0,cacheDataLoaded:h,cacheEntryRemoved:u},D=s(g,E);Promise.resolve(D).catch(B=>{if(B!==Ge)throw B})}return A};var Xe=({api:e,context:r,queryThunk:c,mutationThunk:T})=>{let d=(0,o.isPending)(c,T),R=(0,o.isRejected)(c,T),S=(0,o.isFulfilled)(c,T),M={};return(m,A)=>{if(d(m)){let{requestId:l,arg:{endpointName:n,originalArgs:t}}=m.meta,g=r.endpointDefinitions[n],x=g?.onQueryStarted;if(x){let p={},y=new Promise((u,h)=>{p.resolve=u,p.reject=h});y.catch(()=>{}),M[l]=p;let a=e.endpoints[n].select(g.type==="query"?t:l),s=A.dispatch((u,h,f)=>f),i={...A,getCacheEntry:()=>a(A.getState()),requestId:l,extra:s,updateCachedData:g.type==="query"?u=>A.dispatch(e.util.updateQueryData(n,t,u)):void 0,queryFulfilled:y};x(t,i)}}else if(S(m)){let{requestId:l,baseQueryMeta:n}=m.meta;M[l]?.resolve({data:m.payload,meta:n}),delete M[l]}else if(R(m)){let{requestId:l,rejectedWithValue:n,baseQueryMeta:t}=m.meta;M[l]?.reject({error:m.payload??m.error,isUnhandledError:!n,meta:t}),delete M[l]}}};var Ze=({api:e,context:{apiUid:r},reducerPath:c})=>(T,d)=>{e.util.resetApiState.match(T)&&d.dispatch(e.internalActions.middlewareRegistered(r)),typeof process<"u"};var et=require("immer");var tt=({api:e,queryThunk:r,internalState:c})=>{let T=`${e.reducerPath}/subscriptions`,d=null,R=null,{updateSubscriptionOptions:S,unsubscribeQueryResult:M}=e.internalActions,k=(t,g)=>{if(S.match(g)){let{queryCacheKey:p,requestId:y,options:a}=g.payload;return t?.[p]?.[y]&&(t[p][y]=a),!0}if(M.match(g)){let{queryCacheKey:p,requestId:y}=g.payload;return t[p]&&delete t[p][y],!0}if(e.internalActions.removeQueryResult.match(g))return delete t[g.payload.queryCacheKey],!0;if(r.pending.match(g)){let{meta:{arg:p,requestId:y}}=g,a=t[p.queryCacheKey]??={};return a[`${y}_running`]={},p.subscribe&&(a[y]=p.subscriptionOptions??a[y]??{}),!0}let x=!1;if(r.fulfilled.match(g)||r.rejected.match(g)){let p=t[g.meta.arg.queryCacheKey]||{},y=`${g.meta.requestId}_running`;x||=!!p[y],delete p[y]}if(r.rejected.match(g)){let{meta:{condition:p,arg:y,requestId:a}}=g;if(p&&y.subscribe){let s=t[y.queryCacheKey]??={};s[a]=y.subscriptionOptions??s[a]??{},x=!0}}return x},m=()=>c.currentSubscriptions,n={getSubscriptions:m,getSubscriptionCount:t=>{let x=m()[t]??{};return U(x)},isRequestSubscribed:(t,g)=>!!m()?.[t]?.[g]};return(t,g)=>{if(d||(d=JSON.parse(JSON.stringify(c.currentSubscriptions))),e.util.resetApiState.match(t))return d=c.currentSubscriptions={},R=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(t))return[!1,n];let x=k(c.currentSubscriptions,t),p=!0;if(x){R||(R=setTimeout(()=>{let s=JSON.parse(JSON.stringify(c.currentSubscriptions)),[,i]=(0,et.produceWithPatches)(d,()=>s);g.next(e.internalActions.subscriptionsUpdated(i)),d=s,R=null},500));let y=typeof t.type=="string"&&!!t.type.startsWith(T),a=r.rejected.match(t)&&t.meta.condition&&!!t.meta.arg.subscribe;p=!y&&!a}return[p,!1]}};function nt(e){let{reducerPath:r,queryThunk:c,api:T,context:d}=e,{apiUid:R}=d,S={invalidateTags:(0,o.createAction)(`${r}/invalidateTags`)},M=l=>l.type.startsWith(`${r}/`),k=[Ze,We,Ve,$e,Ye,Xe];return{middleware:l=>{let n=!1,g={...e,internalState:{currentSubscriptions:{}},refetchQuery:A,isThisApiSliceAction:M},x=k.map(a=>a(g)),p=tt(g),y=Je(g);return a=>s=>{if(!(0,o.isAction)(s))return a(s);n||(n=!0,l.dispatch(T.internalActions.middlewareRegistered(R)));let i={...l,next:a},u=l.getState(),[h,f]=p(s,i,u),Q;if(h?Q=a(s):Q=f,l.getState()[r]&&(y(s,i,u),M(s)||d.hasRehydrationInfo(s)))for(let E of x)E(s,i,u);return Q}},actions:S};function A(l,n,t={}){return c({type:"query",endpointName:l.endpointName,originalArgs:l.originalArgs,subscribe:!1,forceRefetch:!0,queryCacheKey:n,...t})}}function H(e,...r){return Object.assign(e,...r)}var rt=require("immer");var re=Symbol(),pe=({createSelector:e=o.createSelector}={})=>({name:re,init(r,{baseQuery:c,tagTypes:T,reducerPath:d,serializeQueryArgs:R,keepUnusedDataFor:S,refetchOnMountOrArgChange:M,refetchOnFocus:k,refetchOnReconnect:m,invalidationBehavior:A},l){(0,rt.enablePatches)();let n=I=>(typeof process<"u",I);Object.assign(r,{reducerPath:d,endpoints:{},internalActions:{onOnline:L,onOffline:V,onFocus:_,onFocusLost:W},util:{}});let{queryThunk:t,mutationThunk:g,patchQueryData:x,updateQueryData:p,upsertQueryData:y,prefetch:a,buildMatchThunkActions:s}=we({baseQuery:c,reducerPath:d,context:l,api:r,serializeQueryArgs:R,assertTagType:n}),{reducer:i,actions:u}=Oe({context:l,queryThunk:t,mutationThunk:g,reducerPath:d,assertTagType:n,config:{refetchOnFocus:k,refetchOnReconnect:m,refetchOnMountOrArgChange:M,keepUnusedDataFor:S,reducerPath:d,invalidationBehavior:A}});H(r.util,{patchQueryData:x,updateQueryData:p,upsertQueryData:y,prefetch:a,resetApiState:u.resetApiState}),H(r.internalActions,u);let{middleware:h,actions:f}=nt({reducerPath:d,context:l,queryThunk:t,mutationThunk:g,api:r,assertTagType:n});H(r.util,f),H(r,{reducer:i,middleware:h});let{buildQuerySelector:Q,buildMutationSelector:E,selectInvalidatedBy:D,selectCachedArgsForQuery:B}=je({serializeQueryArgs:R,reducerPath:d,createSelector:e});H(r.util,{selectInvalidatedBy:D,selectCachedArgsForQuery:B});let{buildInitiateQuery:b,buildInitiateMutation:v,getRunningMutationThunk:P,getRunningMutationsThunk:C,getRunningQueriesThunk:O,getRunningQueryThunk:N}=Pe({queryThunk:t,mutationThunk:g,api:r,serializeQueryArgs:R,context:l});return H(r.util,{getRunningMutationThunk:P,getRunningMutationsThunk:C,getRunningQueryThunk:N,getRunningQueriesThunk:O}),{name:re,injectEndpoint(I,K){let q=r;q.endpoints[I]??={},ae(K)?H(q.endpoints[I],{name:I,select:Q(I,K),initiate:b(I,K)},s(t,I)):Be(K)&&H(q.endpoints[I],{name:I,select:E(),initiate:v(I)},s(g,I))}}}});var it=de(pe());
//# sourceMappingURL=rtk-query.production.min.cjs.map